package com.dycong.common.leetcode.yi;

import java.util.LinkedList;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: yilin
 * Date: 2019-09-05
 * Time: 9:58
 * https://blog.csdn.net/wwxy1995/article/details/91048373
 */
public class Pork {


    public static void sort2(int[] pokers) {
        LinkedList<Integer> pokerList = new LinkedList<>();

        for (Integer portk : pokers) {
            pokerList.add(portk);
        }

        //声明一个目标容器，理解成手
        LinkedList<Integer> newPokers2 = new LinkedList<>();
        for (Integer aPokerList : pokerList) {
            if (newPokers2.size() > 0) {
                //将第一张放在牌堆的最后
                newPokers2.addFirst(newPokers2.pollLast());
            }
            //从桌子上拿一张牌放在手上
            newPokers2.addFirst(aPokerList);
        }
    }
}
